#ifndef ERRORREPORTER_H
#define ERRORREPORTER_H

#include <QString>
#include <QVariant>
#include <QTextStream>

class ErrorReporter
{
public:
    ErrorReporter() {stream.setString(&buffer, QIODevice::WriteOnly);}
    ErrorReporter(const ErrorReporter &rep) {buffer = rep.buffer;}
    ~ErrorReporter();
    inline ErrorReporter& operator<<(const QString &s) {stream << s;return *this;}
    inline ErrorReporter& operator<<(const char* c) {stream <<c;return *this;}
    inline ErrorReporter& operator<<(qint32 i) {stream << i;return *this;}
    inline ErrorReporter& operator<<(quint32 i) {stream << i;return *this;}
    inline ErrorReporter& operator<<(const QVariant &v) {stream <<v.toString();return *this;}

private:
    QTextStream stream;
    QString buffer;
};

inline ErrorReporter eReporter() { return ErrorReporter(); }

#endif // ERRORREPORTER_H
